package com.atguigu.tingshu.search.service;

import co.elastic.clients.elasticsearch.core.SearchRequest;
import co.elastic.clients.elasticsearch.core.SearchResponse;
import com.atguigu.tingshu.model.search.AlbumInfoIndex;
import com.atguigu.tingshu.model.search.SuggestIndex;
import com.atguigu.tingshu.query.search.AlbumIndexQuery;
import com.atguigu.tingshu.vo.search.AlbumInfoIndexVo;
import com.atguigu.tingshu.vo.search.AlbumSearchResponseVo;

import java.util.List;
import java.util.Map;

public interface SearchService {

    void upperAlbum(Long albumId);

    void lowerAlbum(Long albumId);

    AlbumSearchResponseVo search(AlbumIndexQuery albumIndexQuery);



    /**
     * 基于检索条件对象封装检索请求对象（封装完整DSL语句）
     * @param albumIndexQuery
     * @return
     */
    SearchRequest buildDSL(AlbumIndexQuery albumIndexQuery);

    /**
     * 解析ES检索结果
     * @param searchResponse
     * @param albumIndexQuery
     * @return
     */
    AlbumSearchResponseVo parseSearchResult(SearchResponse<AlbumInfoIndex> searchResponse, AlbumIndexQuery albumIndexQuery);

    List<Map<String, Object>> searchTopCategoryHotAlbum(Long category1Id);

    void saveSuggestIndex(AlbumInfoIndex albumInfoIndex);

    List<String> completeSuggest(String keyword);

    List<String> parseSuggestResult(SearchResponse<SuggestIndex> searchResponse, String suggestName);

    void updateLatelyAlbumRanking();

    List<AlbumInfoIndexVo> getRankingList(Long category1Id, String dimension);
}
